package routers

import (
	"pets.ser163.cn/controllers" // 替换为你的实际项目路径
	"pets.ser163.cn/middleware"  // 替换为你的实际项目路径

	"github.com/gin-gonic/gin"
)

func InitAPIRoutes(r *gin.Engine) {
	// 首页
	r.GET("/", controllers.GetIndex)
	r.GET("/pets", controllers.GetPets)
	// 排除鉴权中间件的路由
	r.POST("/api/login", controllers.Login)
	r.POST("/api/register", controllers.Register)

	// 路由分组，添加鉴权中间件
	apiGroup := r.Group("/api")
	apiGroup.Use(middleware.AuthMiddleware())
	{
		apiGroup.GET("/users", controllers.GetUsers)
		apiGroup.POST("/users", controllers.CreateUser)
	}

	// Redis 读写
	redisGroup := r.Group("/redis")
	{
		redisGroup.GET("/set", controllers.SetRedisData)
		redisGroup.GET("/get", controllers.GetRedisData)
	}

	// 队列
	r.GET("/enqueue", controllers.GetQueue)

}
